package com.bileetacrm;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class BileetaSalesInquirySummaryActivity extends Activity{
	
	/*********** Details View Panals *************/
	LinearLayout linearLayoutLeadInfo, linearSalesInquiryInfo,
			linearAddressDetailsInfo, linearAdditionalInfo;
	/*********** Details Onclick View Panals *************/
	LinearLayout linearLayoutLeadInfoHeader, linearSalesInquiryHeader,
			linearAddressDetailsHeader, linearAdditionalInfoHeader;
	/*********** Details Onclick Image View Panals *************/
	ImageView linearLayoutLeadInfoImage, linearSalesInquiryImage,
			linearAddressDetailsImage, linearAdditionalInfoImage;
	int LeadDet = 0,InquiryDet = 0,AddressDet = 0,AdditionalDet = 0;
	/*************** Onclick Handlers **************************/
	
	public void LeadInfoSummaryView(View view) {
		if(LeadDet == 0){
			LeadDet = 1;
			linearLayoutLeadInfo.setVisibility(view.VISIBLE);
			linearLayoutLeadInfoImage.setImageResource(R.drawable.downarraw);
		}
		else{
			LeadDet = 0;
			linearLayoutLeadInfo.setVisibility(view.GONE);
			linearLayoutLeadInfoImage.setImageResource(R.drawable.uparraw);
		}
		
	}

	public void SalesInquirySummaryView(View view) {
		if(InquiryDet == 0){
			InquiryDet = 1;
			linearSalesInquiryInfo.setVisibility(view.VISIBLE);
			linearSalesInquiryImage.setImageResource(R.drawable.downarraw);
		}
		else{
			InquiryDet = 0;
			linearSalesInquiryInfo.setVisibility(view.GONE);
			linearSalesInquiryImage.setImageResource(R.drawable.uparraw);
		}
	}

	public void AddressDetailsSummaryView(View view) {
		if(AddressDet == 0){
			AddressDet = 1;
			linearAddressDetailsInfo.setVisibility(view.VISIBLE);
			linearAddressDetailsImage.setImageResource(R.drawable.downarraw);
		}
		else{
			AddressDet = 0;
			linearAddressDetailsInfo.setVisibility(view.GONE);
			linearAddressDetailsImage.setImageResource(R.drawable.uparraw);
		}
	}

	public void AdditionalInfoSummaryView(View view) {
		if(AdditionalDet == 0){
			AdditionalDet = 1;
			linearAdditionalInfo.setVisibility(view.VISIBLE);
			linearAdditionalInfoImage.setImageResource(R.drawable.downarraw);
		}
		else{
			AdditionalDet = 0;
			linearAdditionalInfo.setVisibility(view.GONE);
			linearAdditionalInfoImage.setImageResource(R.drawable.uparraw);
		}
		
	}
	
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.bileeta_sales_inquiry_summary_activity);
		
		
		linearLayoutLeadInfo = (LinearLayout) findViewById(R.id.linearLayoutLeadInfo);
		linearSalesInquiryInfo = (LinearLayout) findViewById(R.id.linearSalesInquiryInfo);
		linearAddressDetailsInfo = (LinearLayout) findViewById(R.id.linearAddressDetailsInfo);
		linearAdditionalInfo = (LinearLayout) findViewById(R.id.linearAdditionalInfo);
		linearLayoutLeadInfoHeader = (LinearLayout) findViewById(R.id.linearLayoutLeadInfoHeader);
		linearSalesInquiryHeader = (LinearLayout) findViewById(R.id.linearSalesInquiryHeader);
		linearAddressDetailsHeader = (LinearLayout) findViewById(R.id.linearAddressDetailsHeader);
		linearAdditionalInfoHeader = (LinearLayout) findViewById(R.id.linearAdditionalInfoHeader);
		
		linearLayoutLeadInfoImage= (ImageView) findViewById(R.id.linearLayoutLeadInfoImage);
		linearSalesInquiryImage= (ImageView) findViewById(R.id.linearSalesInquiryImage);
		linearAddressDetailsImage= (ImageView) findViewById(R.id.linearAddressDetailsImage);
		linearAdditionalInfoImage= (ImageView) findViewById(R.id.linearAdditionalInfoImage);
		
		linearLayoutLeadInfoImage.setImageResource(R.drawable.uparraw);
		linearSalesInquiryImage.setImageResource(R.drawable.uparraw);
		linearAddressDetailsImage.setImageResource(R.drawable.uparraw);
		linearAdditionalInfoImage.setImageResource(R.drawable.uparraw);
		
		
		
		
		/********** Android Drawer Menu Action ****************/
		Button buttonAddInquiry = (Button) findViewById(R.id.menu_add_inquiry);
		buttonAddInquiry.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent myIntent = new Intent(BileetaSalesInquirySummaryActivity.this,
						BileetaAddNewInquery.class);
				myIntent.putExtra("TAGID", "24");
				startActivityForResult(myIntent, 0);

			}
		});

		Button buttonAddEvent = (Button) findViewById(R.id.menu_add_event);
		buttonAddEvent.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent myIntent = new Intent(BileetaSalesInquirySummaryActivity.this,
						BileetaAddNewEvent.class);
				myIntent.putExtra("TAGID", "24");
				startActivityForResult(myIntent, 0);

			}
		});

		Button buttonAddtionalInfo = (Button) findViewById(R.id.menu_additional_info);
		buttonAddtionalInfo.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent myIntent = new Intent(BileetaSalesInquirySummaryActivity.this,
						BileetaAddLeadAdditionalInfo.class);
				myIntent.putExtra("TAGID", "24");
				startActivityForResult(myIntent, 0);

			}
		});

		Button buttonAddContact = (Button) findViewById(R.id.menu_add_to_contacts);
		buttonAddContact.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent myIntent = new Intent(BileetaSalesInquirySummaryActivity.this,
						BileetaAddContactInformation.class);
				myIntent.putExtra("TAGID", "24");
				startActivityForResult(myIntent, 0);

			}
		});
	}
	
	@Override
	public void onBackPressed()
	{
		Intent myIntent = new Intent(BileetaSalesInquirySummaryActivity.this,
				BileetaDashbordActivity.class);
		startActivityForResult(myIntent, 0);
	     // code here to show dialog
	     super.onBackPressed();  // optional depending on your needs
	}
}
